﻿package cn.wangkai.peanut.system.dao.sequence;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import com.alibaba.fastjson.JSONObject;

import cn.wangkai.peanut.db.WKDbException;
import cn.wangkai.peanut.db.iface.IMyDb;
import cn.wangkai.peanut.db.manager.Manager;
import cn.wangkai.peanut.db.util.ManagerException;
import cn.wangkai.peanut.db.util.PageModel;
import cn.wangkai.peanut.system.model.Codetable;

public interface CodetableManager extends Manager<Codetable> {

	/**
	 * 删除Codetable 
	 * @param itemNoList Codetable 
	 */
	public void delete(IMyDb db,Long[] itemNoList)  throws SQLException, WKDbException, ManagerException, WKDbException  ;
	/**
	 * 获得分页
	 * @param pageNo 当前页数
	 * @param pageSize 每页显示数
	 * @return 分页数据
	 */
	public PageModel<Map<String, Object>> findAll(IMyDb db,String code,String name,String pcode,String category,Integer status,int pageNo, int pageSize)  throws SQLException, WKDbException, ManagerException, WKDbException  ;
	
	/**
	 * 获得Codetable 数据
	 * @param conn 
	 * @return Codetable 列表
	 */
	public List<Codetable> findAll(IMyDb db,String name,String pcode,String category)  throws SQLException, WKDbException, ManagerException, WKDbException  ;
	
	public List<Codetable> findAllByPcode(IMyDb db,String name,String pcode,String category)  throws SQLException, WKDbException, ManagerException, WKDbException ;
	
	
	public List<Map<String, Object>> findAllByNames(IMyDb db,String names,String category)  throws SQLException, WKDbException, ManagerException, WKDbException  ;
	
	/**
	 * 
	 * @param conn
	 * @param codetable
	 * @return
	 * @ throws SQLException, WKDbException, ManagerException, WKDbException 
	 */
	public List<Codetable> finddelist(IMyDb db,Codetable codetable)  throws SQLException, WKDbException, ManagerException, WKDbException ;
	
	/**
	 * 
	 * @param conn
	 * @param code
	 * @param category
	 * @return
	 * @throws SQLException
	 */
	public Codetable findByCode(IMyDb db, String code, String category) throws SQLException, WKDbException;
	/**
	 * 
	 * @param conn
	 * @param name
	 * @param code
	 * @param category
	 * @return
	 * @ throws SQLException, WKDbException, ManagerException, WKDbException 
	 */
	public List<Codetable> findAllByCode(IMyDb db,String name,String code,String category)  throws SQLException, WKDbException, ManagerException, WKDbException ;
	
	/**
	 * 
	 * @param codetableid Codetable 
	 * @param conn 
	 * @return Codetable 
	 */
	public Codetable findById(IMyDb db,Long codetableid)  throws SQLException, WKDbException, ManagerException, WKDbException  ;
	public String findNameByCode(IMyDb db,String code,String name,String pcode,String category,Long codetableid)   throws SQLException, WKDbException, ManagerException, WKDbException ;
	public String findNamesByCode(IMyDb db,String code,String category)   throws SQLException, WKDbException, ManagerException, WKDbException ;
	/**
	 * 
	 * @param conn
	 * @param code
	 * @return
	 * @ throws SQLException, WKDbException, ManagerException, WKDbException 
	 */
	public Codetable findByCode(IMyDb db,String code,String name,String pcode,String category,Long codetableid)   throws SQLException, WKDbException, ManagerException, WKDbException ;
	
	/**
	 * 
	 * @param conn
	 * @param pcode
	 * @param category
	 * @return
	 * @ throws SQLException, WKDbException, ManagerException, WKDbException 
	 */
	public List<Codetable> findAllByCode(IMyDb db,String pcode,String category)   throws SQLException, WKDbException, ManagerException, WKDbException  ;
	
	/**
	 * 
	 * @param conn
	 * @param category
	 * @return
	 * @ throws SQLException, WKDbException, ManagerException, WKDbException 
	 */
	public int findCategoryNum(IMyDb db,String category)   throws SQLException, WKDbException, ManagerException, WKDbException  ;
	
	/**
	 * 
	 * @param conn
	 * @param pid 上级代码
	 * @param category 分类
	 * @param ids 默认选中项
	 * @param getall
	 * @return
	 * @ throws SQLException, WKDbException, ManagerException, WKDbException 
	 */
	public List<JSONObject> gettree(IMyDb db,String pid,String category,String[] ids,boolean getall) throws SQLException, WKDbException, ManagerException;
	
	/**
	 * 
	 * @param code
	 * @param name
	 * @param pcode
	 * @param category
	 * @param codetableid
	 * @return
	 * @ throws SQLException, WKDbException, ManagerException, WKDbException 
	 */
	public Codetable findCacheByCode(String code,String name,String pcode,String category,Long codetableid)   throws SQLException, WKDbException, ManagerException, WKDbException ;
	
	
	public void destroy();


}